package com.laogao.lesson037.controller;

import com.laogao.lesson037.common.Result;
import com.laogao.lesson037.common.ResultUtils;
import com.laogao.lesson037.dto.CashOutRequest;
import com.laogao.lesson037.service.ICashOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <b>description</b>： Java进阶、性能优化实战案例100讲，微信公众号:程序员恰恰，源码 & 文档 & 技术支持，请加个人微信号：it3306 <br>
 * <b>time</b>：2025/3/1 6:50 <br>
 * <b>author</b>：ready lao_gao
 */
@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private ICashOutService cashOutService;

    @RequestMapping("/cashOut")
    public Result<Boolean> cashOut(@RequestBody CashOutRequest request) {
        //这里可以先拿到用户ID
        String accountId = "1";
        this.cashOutService.cashOut(accountId, request.getPrice());
        return ResultUtils.success(Boolean.TRUE);
    }
}
